<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "/jeesms_sys/head.html"/>
</head>
<script>
function getQueryForm(){
	return document.getElementById("queryForm");
}

Statistic = {};
Statistic.date = new Date();
Statistic.MonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];  
Statistic.CurrYear = function(){
	return this.date.getFullYear().toString();  
};  
Statistic.CurrMonth = function(){
	return this.date.getMonth();  
};  
Statistic.CurrDay = function(){
	return this.date.getDate();  
};  
Statistic.InitYearSelect = function(){
	var years = this.CurrYear();
	for (var i = years - 10; i <= years; i++) {  
		$("#year").get(0).options.add(new Option(i, i));  
	}   
}
Statistic.InitMonthSelect = function(){
	for (var i = 1; i < 13; i++) {  
        $("#month").get(0).options.add(new Option(i, i));  
    }  
};

Statistic.InitData = function(){
	$("#year").val(<#if year??>${year}<#else>this.CurrYear()</#if>);
	$("#month").val(<#if month??>${month}<#else>this.CurrMonth()+1</#if>);
	FlushDay();
	$("#day").val(<#if day??>${day}<#else>this.CurrDay()</#if>);
}

function FlushDay(){
	var year = $("#year");  
    var month = $("#month");  
    var day = $("#day");  
	var mn = month.val();  
    var ye = year.val();  
    var n = Statistic.MonthDays[mn - 1];  
    day.empty();  
    if (ye % 4 == 0 && mn==2) {  
            n++;  
    }  
    for (var i = 1; i < n + 1; i++) {  
        day.get(0).options.add(new Option(i, i));  
    }  
}

function init(){
	$("#year").change(FlushDay);
    $("#month").change(FlushDay); 
	Statistic.InitYearSelect();
	Statistic.InitMonthSelect();
    chgModel($("input[name='queryModel']:checked").val()); 
    Statistic.InitData();
}

function chgModel(queryModel){
	if(queryModel=="year"){
		FlushDay();
		$("#month").attr("disabled","1");
		$("#day").attr("disabled","1");
	}
	if(queryModel=="month"){
		FlushDay();
		$("#month").attr("disabled","");
		$("#day").attr("disabled","1");
	}
	if(queryModel=="week"){
		$("#month").attr("disabled","");
		$("#day").attr("disabled","");
	}
	if(queryModel=="day"){
		$("#month").attr("disabled","");
		$("#day").attr("disabled","");
	}
}

function querySubmit(){
	$("input[name='year']").val($("#year").val());
	$("input[name='month']").val($("#month").val());
	$("input[name='day']").val($("#day").val());
	getQueryForm().submit();
}

$(function(){
	init();
});
</script>
<body>
<div class="box-positon">
	<div class="rpos">当前位置: 统计</div>
	<form class="ropt">
		<input type="submit" value="返回列表" onclick="this.form.action='../house_data/v_propertyStatistics.do';" class="return-button"/>
	</form>
	<div class="clear"></div>
</div>
<div class="body-box">

<form id="queryForm" action="v_list.do" method="post" style="padding-top:5px;">
<input type="hidden" name="name" value="${name!}"/>
<input type="hidden" name="year"/>
<input type="hidden" name="month"/>
<input type="hidden" name="day"/>
<div style="padding-top:5px">
	<select id="year"></select>年
	<select id="month"></select>月
	<select id="day"></select>日
	<input class="query" type="button" value="查询" onclick="querySubmit();"/>
</div>
<div style="padding-top:5px">
<label><input type="radio" name="queryModel" value="year" <#if statisticModel=="year">checked="checked"</#if> onclick="chgModel(this.value);"/>年</label>
<label><input type="radio" name="queryModel" value="month" <#if statisticModel=="month">checked="checked"</#if> onclick="chgModel(this.value);"/>月</label>
<label><input type="radio" name="queryModel" value="week" <#if statisticModel=="week">checked="checked"</#if> onclick="chgModel(this.value);"/>周</label>
<!--  
<label><input type="radio" name="queryModel" value="day" <#if statisticModel=="day">checked="checked"</#if> onclick="chgModel(this.value);"/>日</label>
-->
</div>
</form>

<form id="tableForm" method="post">
<table class="pn-ltable" style="" width="100%" cellspacing="1" cellpadding="0" border="0">
<thead class="pn-lthead">
<tr>
	<th>月份</th>
	<th>房产项目名称</th>
	<th>开发企业</th>
	<th>区域</th>
	<th>单盘成交数</th>
	<th>单盘成交金额</th>
    <th>单盘成交建面</th>
    <th>单盘成交套内</th>
    <th>单盘平均公摊</th>
    <th>单盘单套金额</th>
    <th>单盘建面价格</th>
    <th>单盘套内价格</th>
    <th>单盘单套建面</th>
    <th>单盘单套套内</th>
</tr>
</thead>
<tbody  class="pn-ltbody">
<#list list as cmsStatistic>
<tr onmouseover="this.bgColor='#eeeeee'" onmouseout="this.bgColor='#ffffff'">
<td>
<#switch statisticModel>
	<#case "year">
		${cmsStatistic.description}月
	<#break>
	<#case "month">
		${cmsStatistic.description}日
	<#break>
	<#case "week">
		星期${cmsStatistic.description}
	<#break>
	<#case "day">
		${cmsStatistic.description}
	<#default>
	<#break>
</#switch>
</td>
<td>${cmsStatistic.object[0]!}</td>
<td>${cmsStatistic.object[1]!}</td>
<td>${cmsStatistic.object[2]!}</td>
<td>${cmsStatistic.object[3]!}</td>
<td>${cmsStatistic.object[4]!}</td>
<td>${cmsStatistic.object[5]!}</td>
<td>${cmsStatistic.object[6]!}</td>
<td>${cmsStatistic.object[7]!}</td>
<td>${cmsStatistic.object[8]!}</td>
<td>${cmsStatistic.object[9]!}</td>
<td>${cmsStatistic.object[10]!}</td>
<td>${cmsStatistic.object[11]!}</td>
<td>${cmsStatistic.object[12]!}</td>
</tr>
</#list>
</tbody>
</table>
</form>
</div>
</body>
</html>